﻿@{
    Layout = "~/Views/Shared/PlanPartial/_LayoutSearch.cshtml";
}

@using Wicresoft.UnifyShow.Business;
@{
    var group = ViewData["PlanGroup"] ?? new List<PlanGroupModel>();
    var groups = group as List<PlanGroupModel>;
}
<div class="parameter">
    <div class="parameter_name" style="width: 100px;">计划任务组：</div>
    <div class="parameter_input" style="width: 245px;">
        <select style="width: 85%;" id="planGroup" onchange="startSearch()">
            @foreach (var item in groups)
            { 
                <option value="@(item.ID)">@(item.GroupName)</option>
            }
        </select>
    </div>
</div>

<div style="padding: 10px 0;">
    <table id="ResponsibleList" class="" title="人员信息" style="height:335px;"
        fitcolumns="true" singleselect="true" pagination="true">
        <thead>
            <tr>
                <th data-options="field:'ck',checkbox:true"></th>
                <th field="Company" width="120">单位</th>
                <th field="Department" width="120">部门</th>
                <th field="DisplayName">姓名</th>
                <th field="ID"></th>
                <th field="Position" width="120">职务</th>
            </tr>
        </thead>
    </table>
</div>

<script type="text/javascript">
    var AddRow = function () {
        var selected = $('#ResponsibleList').datagrid('getSelections'),
            parenter = GetParentWindow();

        if (parenter && selected.length) {
            parenter.addResponsible(selected);
            closeWindow();
        }
    };

    var startSearch = function () {
        $('#ResponsibleList').datagrid('load', { groupID: $('#planGroup').val() });
    };

    $(function () {
        $('#ResponsibleList').datagrid({
            url: '/PlanManagement/SerachGroupUserResult',
            pageList: [10],
            pageSize: 10,
            pageNumber: 1,
            queryParams: { groupID: $('#planGroup').val() }
        });

        $('#ResponsibleList').datagrid('hideColumn', 'ID');
        var p2 = $('#ResponsibleList').datagrid('getPager');
        $(p2).pagination({
            beforePageText: '第',
            afterPageText: '页&nbsp;共&nbsp;{pages}&nbsp;页',
            displayMsg: '当前显示{from} - {to}&nbsp;条记录&nbsp;共&nbsp;{total}&nbsp;条记录'

        });
    });
</script>
